import request from '@/utils/request'
import { captchaResult, starUser, loginForm } from '@/model/common/login/model'

export function getRSAkey () {
  return request({
    url: '/starLogin/getPublicKey',
    method: 'post'
  })
}

export function getCode (data: string) {
  return request<captchaResult>({
    url: `/starLogin/captcha?codeTag=${data}`
  })
}

export function doLogin (data: loginForm) : Promise<starUser> {
  return request({
    url: '/starLogin/doLogin',
    data: data,
    method: 'post'
  })
}

export function loginOut () {
  return request({
    url: '/starLogin/logout',
    method: 'get'
  })
}
